import axios from "axios";
// axios.defaults.headers.common['token'] = localStorage.getItem('token')  // 在header中添加token
import {
  Host_Ip2
} from "../config.js"

//获取暂存表单内容
function GetFormLastTime() {
    return axios({
        url: Host_Ip2 + '/admin/stuApplyPark/getMine',
        headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
        method: "GET",
    })
}
//暂存表单内容
function SaveFormLastTime(params) {
    return axios({
        url: Host_Ip2 + '/admin/stuApplyPark/stage',
        headers: { 'Content-Type': 'application/json' },
        method: "POST",
        data: params
    })
}
//提交表单
function SubmitForm(params) {
    return axios({
        url: Host_Ip2 + '/admin/stuApplyPark/save',
        headers: { 
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${localStorage.getItem('token')}`
         },
        method: "POST",
        data: params
    })
}
//再次提交表单
function SubmitForm2(params) {
    return axios({
        url: Host_Ip2 + '/admin/stuApplyPark/update',
        headers: { 
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${localStorage.getItem('token')}`
         },
        method: "POST",
        data: params
    })
}
//获取上次图片
function GetImgLastTime() {
    return axios({
        url: Host_Ip2 + '/admin/stuSignature/getLast',
        method: "GET"
    })
}
//获取临时图片
function GetImgTempTime(num) {
    return axios({
        url: Host_Ip2 + '/admin/stuSignature/getByUUID?num=' + num,
        method: "GET"
    })
}
//上传附件 图片  fileName
function SetFiles(params) {
    return axios({
        url: Host_Ip2 + '/dfs/upload/?num=',
        method: "POST",
        data: params
    })
}
//上传图片临时 + 随机值
function SetImgFiles(params, num) {
    return axios({
        url: Host_Ip2 + '/admin/stuSignature/upload?num=' + num,
        method: "POST",
        data: params
    })
}
//登录账号
function loginAccount() {
    return axios({
        url: Host_Ip2 + '/login/slide',
        method: "POST"
    })
}
//获取已提交列表
function GetFormList() {
    return axios({
        url: Host_Ip2 + '/admin/stuApplyPark/list',
        method: "GET"
    })
}
//获取列表详情 暂时未用
function GetFormItem(params) {
    return axios({
        url: Host_Ip2 + '/admin/stuApplyPark/get/' + params,
        method: "GET"
    })
}
//审批
function toNextLev() {
    return axios({
        url: Host_Ip2 + '/admin/stuApplyPark/approve',
        method: "POST"
    })
}
//提交企业见习申请
function SubmitFormJianxi(params) {
    return axios({
        url: Host_Ip2 + '/admin/internship/save',
        headers: { 
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${localStorage.getItem('token')}`
         },
        method: "POST",
        data: params
    })
}
//再次提交表单
function SubmitFormJianxi2(params) {
    return axios({
        url: Host_Ip2 + '/admin/internship/update',
        headers: { 
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${localStorage.getItem('token')}`
         },
        method: "POST",
        data: params
    })
}
//获取企业见习列表
function GetJianxiFormList() {
    return axios({
        url: Host_Ip2 + '/admin/internship/getMine',
        headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
        method: "GET",
    })
}
//提交带动就业补贴申请
function SubmitFormJiuye(params) {
    return axios({
        url: Host_Ip2 + '/admin/employmentSubsidy/save',
        headers: { 
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${localStorage.getItem('token')}`
         },
        method: "POST",
        data: params
    })
}
//再次提交表单
function SubmitFormJiuye2(params) {
    return axios({
        url: Host_Ip2 + '/admin/employmentSubsidy/update',
        headers: { 
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${localStorage.getItem('token')}`
         },
        method: "POST",
        data: params
    })
}
//获取带动就业补贴列表
function GetJiuyeFormList() {
    return axios({
        url: Host_Ip2 + '/admin/employmentSubsidy/getMine',
        headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
        method: "GET",
    })
}
//提交租金补贴申请
function SubmitFormzujin(params) {
    return axios({
        url: Host_Ip2 + '/admin/rentSubsidy/save',
        headers: { 
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${localStorage.getItem('token')}`
         },
        method: "POST",
        data: params
    })
}
//再次提交表单
function SubmitFormzujin2(params) {
    return axios({
        url: Host_Ip2 + '/admin/rentSubsidy/update',
        headers: { 
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${localStorage.getItem('token')}`
         },
        method: "POST",
        data: params
    })
}
//获取租金补贴列表
function GetZuJingFormList() {
    return axios({
        url: Host_Ip2 + '/admin/rentSubsidy/getMine',
        headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
        method: "GET",
    })
}
// 注册
function registerSubmit(params) {
    return axios({
        url: Host_Ip2 + '/user/register/submit',
        headers: { 'Content-Type': 'application/json' },
        method: "POST",
        params: params
    })
}
// 登录 
function loginForm(params) {
    return axios({
        url: Host_Ip2 + '/login/slide',
        headers: { 'Content-Type': 'application/json' },
        method: "POST",
        data: params
    })
}

//获取验证码 waiting
// { mobile: values.mobile, smsType: 'MEMBER_REGISTER' }
// { mobile: values.mobile, smsType: 'MEMBER_LOGIN' }
function getSms(params) {
    return axios({
        url: Host_Ip2 + '/system/sms/send',
        method: "GET",
        params: params,
    })
}

export {
    GetFormLastTime,
    SaveFormLastTime,
    SubmitForm,
    SubmitForm2,
    GetImgLastTime,
    SetFiles,
    loginAccount,
    GetFormList,
    GetFormItem,
    toNextLev,
    SetImgFiles,
    GetImgTempTime,
    SubmitFormJianxi,
    SubmitFormJianxi2,
    SubmitFormJiuye,
    SubmitFormJiuye2,
    SubmitFormzujin,
    SubmitFormzujin2,
    registerSubmit,
    loginForm,
    getSms,
    GetZuJingFormList,
    GetJianxiFormList,
    GetJiuyeFormList
}